home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-04-26 | 4.7 KB | 183 lines | [TEXT/MPS ] |
- #
- # "InstallGCC" <options>
- #
- # Location:
- # top level of GCC directory, do not move!
- #
- # Created July 1992
- # by: Brent Pease (person to complain to and send bug reports)
- # Stan Shebs
- #
- # Purpose:
- # To install the GCC compiler for a specific back end and stage
- # by coping the appropriate files into the selected tools and scripts
- # directory.
- #
- # Options:
- # Do "InstallGCC -help" to see all the options.
- #
-
- Set SaveDir `Directory`
-
- Set DefaultTargetMachine "Mac68K"
-
- Set MustBuild 0
- Set MustInstall 1
- Set NumStages 1
- Set OrigScriptPlace "Scripts:"
- Set OrigToolPlace "Tools:"
- Set AskForScriptPlace 1
- Set AskForToolPlace 1
- Set TargetMachineList ""
- Set ToolList ""
- Set TargetMachineToolList ""
- Set ConfirmDup ""
- Set Testing ""
- Set CheckArg ""
-
- Loop
- Break If "{#}" == 0
- If "{1}" =~ /-build/
- Set MustBuild 1
- Else if "{1}" =~ /-check/
- Set Testing "Echo ' '"
- Set CheckArg "{1}"
- Else if "{1}" =~ /-help/
- echo "InstallGCC [ options | machines ] ... # Install/Build GNU C Compiler"
- echo " -build Force a build"
- echo " -check Display commands without executing them"
- echo " -help Display this message"
- echo " -noinstall Don't install anything"
- echo " -only <tools> Do only the tools in <tools>"
- echo " -scripts <dir> Install scripts from <dir>"
- echo " -target <machine> Install/Build for the given target machine"
- echo " -tools <dir> Install tools from <dir>"
- echo " -y Automatically confirm overwrites"
- echo " -[1234] Do 1, 2, 3, or 4 self-build stages"
- echo ""
- echo "Target machines currently available:"
- echo ""
- for TargetFolder in `Files :Targets:`
- If "{TargetFolder}" =~ /:(≈)®1:/
- echo " " "{®1}"
- End If
- End For
- Echo ""
- Exit 0
- Else if "{1}" =~ /-n/
- Else if "{1}" =~ /-noinstall/
- Set MustInstall 0
- Else if "{1}" =~ /-scripts/
- Shift 1
- Set NewScriptPlace "{1}"
- Set AskForScriptPlace 0
- Else if "{1}" =~ /-target/
- Shift 1
- Set TargetMachine "{1}"
- Else if "{1}" =~ /-tools/
- Shift 1
- Set NewToolPlace "{1}"
- Set AskForToolPlace 0
- Else if "{1}" =~ /-y/
- Set ConfirmDup "{1}"
- Else if "{1}" =~ /-([1234])®1/
- Set NumStages "{®1}"
- Else If "`Exists -d :Targets:{1}`" != ""
- # Add the argument to the list of target machines.
- Set TargetMachineList "{TargetMachineList} {1}"
- Else
- # Don't allow any garbage options.
- echo Option ∂""{1}"∂" not understood, exiting
- Exit 1
- End
- Shift 1
- End Loop
-
- If "{TargetMachineList}" == ""
- Set TargetMachineList "{DefaultTargetMachine}"
- End If
-
- If "{ToolList}" == ""
- Set ToolList "gcc_driver"
- End If
-
- If "{TargetMachineToolList}" == ""
- Set TargetMachineToolList "cpp cc1 cc1plus"
- End If
-
- # Repeat the installation procedure for all the requested targets.
-
- For TargetMachine in {TargetMachineList}
- For ToolName in {ToolList}
- If "`Exists :Tools:{ToolName}`" == ""
- Set MustBuild 1
- End If
- End For
- For ToolPrefix in {TargetMachineToolList}
- If "`Exists :Tools:{ToolPrefix}_{TargetMachine}`" == ""
- Set MustBuild 1
- End If
- End For
- # If a build is necessary or demanded explicitly, do it.
- If "{MustBuild}" != 0
- BuildGCC "{TargetMachine}","{NumStages}","all" {CheckArg}
- If {Status} != 0
- Exit 1
- Else
- End If
- End If
- End For
-
- If {AskForToolPlace} != 0
- Directory "{MPW}Tools:"
- Set NewToolPlace "`GetFileName -wd -m "Select a tool destination"`"
- If {status} != 0
- Directory "{SaveDir}"
- exit 1
- End If
- End If
-
- If {AskForScriptPlace} != 0
- Directory "{MPW}Scripts:"
- Set NewScriptPlace "`GetFileName -wd -m "Select a script destination"`"
- If {status} != 0
- Directory "{SaveDir}"
- exit 1
- End If
- End If
-
- If {MustInstall} != 0
- For ScriptName in "gC" "gCPlus"
- set OrigFileName "{SaveDir}{OrigScriptPlace}{ScriptName}"
- {Testing} Duplicate {ConfirmDup} "{OrigFileName}" "{NewScriptPlace}{ScriptName}"
- End For
- For ToolName in "gcc_driver"
- If "`Exists :Tools:{ToolName}`" != ""
- set OrigFileName "{SaveDir}:Tools:{ToolName}"
- Else
- set OrigFileName "{SaveDir}{OrigToolPlace}{ToolName}"
- End If
- {Testing} Duplicate {ConfirmDup} "{OrigFileName}" "{NewToolPlace}{ToolName}"
- End For
- # Install all the target-specific tools requested.
- For TargetMachine in {TargetMachineList}
- For ToolPrefix in "cpp_" "cc1_" "cc1plus_"
- set ToolName "{ToolPrefix}{TargetMachine}"
- Set OrigToolPlace "Stage{NumStages}-{TargetMachine}:"
- set OrigFileName "{SaveDir}{OrigToolPlace}{ToolName}"
- {Testing} Duplicate {ConfirmDup} "{OrigFileName}" "{NewToolPlace}{ToolName}"
- End For
- # The branch-shortening tool is only needed for 68K Macs.
- if "{TargetMachine}" == "Mac68K"
- Set ToolName "shorten"
- Set OrigToolPlace "Stage{NumStages}-{TargetMachine}:"
- set OrigFileName "{SaveDir}{OrigToolPlace}{ToolName}"
- {Testing} Duplicate {ConfirmDup} "{OrigFileName}" "{NewToolPlace}{ToolName}"
- End If
- End For
- End If
-
- Directory "{SaveDir}"
-
- exit 0
-